<?php
	require("akses.php");
	if ($_GET["cek"]=="email") {
		connect();
		$x=$_GET["email"];
		$x = trim($x);
		$atpos=strpos($x,"@");
		$dotpos=strripos($x,".");
		if ($atpos<1 || $dotpos<$atpos+2 || $dotpos+2>=strlen($x))
		{
			echo  "Not a valid e-mail address";
		} else {
			if (!isEmailUnique($x)) {
				echo "This email is already registered.";
			} else {
				echo "OK";
			}
		}
	} else {
		if (isJPG($_GET["avatar"])) {
			echo "OK";
		} else {
			echo "Your photo must have jpeg or jpg file type";
		}
	}
?>